package com.ziyucoding.springboot.labs.lab12.uidprovider.service.impl;

import com.baidu.fsg.uid.UidGenerator;
import com.ziyucoding.springboot.labs.lab12.uidprovider.service.UidGeneratorService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * 全局唯一键生成器服务接口实现类
 *
 * @author ziyucoding
 * @date 2022-11-17
 **/
@Service
public class UidGeneratorServiceImpl implements UidGeneratorService {

    @Resource(name = "cachedUidGenerator")
    private UidGenerator cachedUidGenerator;

    @Override
    public Long generateUid() {
        return cachedUidGenerator.getUID();
    }
}
